import sys

class Script:
	def __init__(self, filename):
		self.file = open(filename)
		
	#From a textfile. Return a value seperated by a chracter
	#flag = int for number, otherwise string
	def get_nvalue( self, name, flag, delimiter):
		for line in self.file:
			term = line.split(delimiter, 1)
			if term[0] == name:
				if flag == "int":
					self.file.seek(0,0)
					return int(term[1])
				else:
					self.file.seek(0,0)
					return term[1].strip('\n')
		self.file.seek(0,0)
		
		
	def get_tuplevalue(self,name,flag,delimiter):
		for line in self.file:
			term = line.split(delimiter, 1)
			if term[0] == name:
				final_term = term[1].strip('\n')
				final_term = final_term.split(",")

				if flag == "int":
					final_term = [ int(x) for x in final_term ]
					self.file.seek(0,0)
					return tuple(final_term)
				else:
					self.file.seek(0,0)
					return tuple(final_term)
		self.file.seek(0,0)
				